package com.bw.controller;

import com.bw.bean.Vo1;
import com.bw.bean.Vo2;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class VoController {
    @Autowired
    VoService voService;

    @RequestMapping("cx1")
    public Map t1()
    {
        List<Vo1> list=voService.cx1();
        return SugarUtil.getLineData(list);
    }

    @RequestMapping("cx2")
    public Map t2()
    {
        List list=new ArrayList();
        list.add("题目内容");
        list.add("答题次数");
        list.add("正确答题");
        list.add("正确率");
        List<Vo2> list1=voService.cx2();
        return SugarUtil.getTablePlayData(list,list1);
    }

    @RequestMapping("cx3")
    public Map t3()
    {
        List list=new ArrayList();
        list.add("试卷名称");
        list.add("考试人数");
        list.add("平均分");
        list.add("平均用时");
        List<Vo2> list1=voService.cx3();
        return SugarUtil.getTablePlayData(list,list1);
    }

    @RequestMapping("cx4")
    public Map t4()
    {
        List<Vo1> list=voService.cx4();
        return SugarUtil.getLineData(list);
    }
}
